package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.JobTaskProvider;
import com.jinmdz.fmis.mapper.entity.JobTaskEntity;

import java.util.ArrayList;

/**
 * 员工工作任务表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface JobTaskMapper {

    /**
     * 增加JobTask
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = JobTaskProvider.class, method = "insertJobTask")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertJobTask(@Param("entity") JobTaskEntity entity);

    /**
     * 删除JobTask
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update job_task set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForJobTask(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改JobTask
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = JobTaskProvider.class, method = "updateJobTask")
    void updateJobTask(@Param("entity") JobTaskEntity entity);

    /**
     * 查询JobTask实体
     * 
     * @param id 主键
     * @return JobTaskEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,business_code,user_id,task_type_code,task_type,table_name,table_id,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from job_task where id = #{id} and deleted = 0 limit 1 ")
    JobTaskEntity getJobTaskById(@Param("id") Integer id);

    /**
     * 查询JobTask列表
     * 
     * @param entity 数据实体
     * @return JobTaskEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = JobTaskProvider.class, method = "listJobTask")
    ArrayList<JobTaskEntity> listJobTask(@Param("entity") JobTaskEntity entity);
}